package com.lx.entity;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author c先生
 * @date 2022年05月05日 下午 3:59:10
 * @describe
 */

public class BankCard {
    /**
     * 银行卡ID
     */
    private String cardId;
    /**
     * 银行卡所有人id
     */
    private Integer usersId;
    /**
     * 银行卡密码
     */
    private String cardPwd;
    /**
     * 银行卡余额
     */
    private Double cardBalance;
    /**
     * 是否挂失0：正常使用  1: 锁定 2：已挂失 :3:注销
     */
    private Integer cardStatus;
    /**
     * 开卡日期（如果此前该客户没有开过卡，则应先开户，在开卡）
     */
    private Date openCard;

    public BankCard() {
    }

    public BankCard(String cardId, Integer usersId, String cardPwd, Double cardBalance, Integer cardStatus, Date openCard) {
        this.cardId = cardId;
        this.usersId = usersId;
        this.cardPwd = cardPwd;
        this.cardBalance = cardBalance;
        this.cardStatus = cardStatus;
        this.openCard = openCard;
    }

    public String getCardId() {
        return cardId;
    }

    public void setCardId(String cardId) {
        this.cardId = cardId;
    }

    public Integer getUsersId() {
        return usersId;
    }

    public void setUsersId(Integer usersId) {
        this.usersId = usersId;
    }

    public String getCardPwd() {
        return cardPwd;
    }

    public void setCardPwd(String cardPwd) {
        this.cardPwd = cardPwd;
    }

    public Double getCardBalance() {
        return cardBalance;
    }

    public void setCardBalance(Double cardBalance) {
        this.cardBalance = cardBalance;
    }

    public Integer getCardStatus() {
        return cardStatus;
    }

    public void setCardStatus(Integer cardStatus) {
        this.cardStatus = cardStatus;
    }

    public Date getOpenCard() {
        return openCard;
    }

    public void setOpenCard(Date openCard) {
        this.openCard = openCard;
    }

    /**
     * 是否挂失0：正常使用  1: 锁定 2：已挂失 :3:注销
     *
     * @return 状态
     */
    private String printStatus() {
        switch (cardStatus) {
            case 0:
                return "卡片正常";
            case 1:
                return "卡片锁定";
            case 2:
                return "卡片挂失";
            case 3:
                return "注销";
            default:
                return null;
        }
    }

    @Override
    public String toString() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        return "银行卡号:" + cardId +
                "  持卡人客户编号 :" + usersId +
                "  银行卡密码:" + cardPwd +
                "  银行卡余额:" + cardBalance +
                "  银行卡状态:" + printStatus() +
                "  开卡时间:" + sdf.format(openCard);
    }
}
